#!/bin/bash

#检查容器状态
status=$(docker inspect -f '{{.State.Running}}' uuwaf)
if [ "${status}" != "true" ]; then
    # 停止5秒后再次检测
    sleep 5
    status=$(docker inspect -f '{{.State.Running}}' uuwaf)
    if [ "${status}" != "true" ]; then
        #如果启动没成功，就杀掉keepalive触发主备切换
        systemctl restart keepalived
    fi
fi